<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>人工导出情况查询</title>
    <link href="../../layui/css/layui.css" rel="stylesheet">
    <link href="../../static/css/style.css" rel="stylesheet">
    <script src="../../static/js/jquery.min.js"></script>
    <script src="../../static/js/jquery.cookie.js"></script>
    <script src="../../layui/layui.js"></script>
    <script src="../../static/js/base.js"></script>
    <script src="../../static/js/ax.js"></script>
    <script src="../../static/js/avalon.js"></script>
    <!--[if lt IE 9]>
    <script src="../../static/js/html5.js"></script>
    <script src="../../static/js/respond.js"></script>
    <![endif]-->
    <style>
    .till{
        text-align: center
    }
    </style>
</head>

<body>
    <div class="layui-fluid" ms-controller="test">
        <div class="layui-card content-wrap">
            <div class="layui-row layui-col-space20">
                <!-- 导出统计 -->
                <div class="row_left layui-col-sm6">
                    <table class="layui-table">
                        <colgroup>
                            <div class="till">导出情况统计 </div>
                        </colgroup>
                        <thead>
                            <tr>
                                <th>状态</th>
                                <th>下载学员</th>
                                <th>无纸化列表</th>
                                <th>指纹</th>
                                <th>原驾驶证</th>
                                <th>制证照</th>
                                <th>签字数据</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr  ms-for="(index, el) in @recordStatistics" :if="el.optType=='exp'">
                                    <td :if="el.dataType=='success'"> 成功</td>
                                    <td :if="el.dataType=='fail'"> 失败</td>
                                <td>{{el.studentCount}}</td>
                                <td>{{el.paperlessListCount }}</td>
                                <td>{{el.fingerprintCount  }}</td>
                                <td>{{el.oldDrivingLicenceCount }}</td>
                                <td>{{el.certificatePhotosCount  }}</td>
                                <td>{{el.signDataCount }}</td>
                            </tr>

                        </tbody>
                    </table>
                </div>
                <!-- 导入统计 -->
                <div class="row_right layui-col-sm6">
                    <table class="layui-table">
                        <colgroup>
                            <div class="till">导入情况统计 </div>
                        </colgroup>
                        <thead>
                            <tr>
                                <th>状态</th>
                                <th>导入学员</th>
                                <th>无纸化列表</th>
                                <th>指纹</th>
                                <th>原驾驶证</th>
                                <th>制证照</th>
                                <th>签字数据</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr  ms-for="(index, el) in @recordStatistics"  :if="el.optType=='imp'">
                                    <td :if="el.dataType=='success'"> 成功</td>
                                    <td :if="el.dataType=='fail'"> 失败</td>
                                    <td>{{el.studentCount}}</td>
                                    <td>{{el.paperlessListCount }}</td>
                                    <td>{{el.fingerprintCount  }}</td>
                                    <td>{{el.oldDrivingLicenceCount }}</td>
                                    <td>{{el.certificatePhotosCount  }}</td>
                                    <td>{{el.signDataCount }}</td>
                                </tr>
                        </tbody>
                    </table>
                </div>

            </div>
            <!--查询-->
            <!--<div class="layui-form layui-card-header layuiadmin-card-header-auto">-->
            <form class="layui-form layui-form-pane">
                <div class="layui-form-item">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-sm4">
                            <label class="layui-form-label">学员列表</label>
                            <div class="layui-input-block">
                                <input type="text" id="noticeTitle" :duplex="searchKey" placeholder="请输入姓名或证件号码" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-col-sm4">
                            <label class="layui-form-label">状态</label>
                            <div class="layui-input-block">
                                <select id="exportStatus" name="exportStatus">
                                    <option value="all">全部</option>
                                    <option value="imp">导入</option>
                                    <option value="exp">导出</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-col-sm4">
                            <label class="layui-form-label">文件</label>
                            <div class="layui-input-block">
                                <select id="fileType" name="fileType">
                                    <option value="all">全部</option>
                                    <option value="normal">无</option>
                                    <option value="sfz">身份证头像</option>
                                    <option value="mqb">互联网面签协议</option>
                                    <option value="cxjs">初学驾驶申请表</option>
                                    <option value="zjjs">增驾驾驶申请表</option>
                                    <option value="zw">指纹</option>
                                    <option value="ljz">原驾驶证</option>
                                    <option value="zzz">制证照</option>
                                    <option value="pxjl">培训记录</option>
                                    <option value="xszm">学时证明</option>
                                    <option value="zzpermit">居住证照片</option>
                                    <option value="idz">身份证正面</option>
                                    <option value="idf">身份证反面</option>
                                    <option value="healthForm">体检表</option>
                                    <option value="scenePhotos">现场照片</option>
                                    <option value="scenePhotos">现场照片</option>
                                    <option value="zjzo">证件照</option>
                                    <option value="tjbtp">提交表图片</option>
                                    <option value="sfzdzz">身份证电子照片</option>
                                    <option value="zcbmqz">注册表面签照</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="layui-row layui-col-space10">

                        <div class="layui-col-sm4">
                            <a id="doSearch" class="layui-btn add_btn" :click="shearch()">
                                <i class="layui-icon layui-icon-search"></i>查询</a>
                            <button type="reset" class="layui-btn delete_btn">
                                <i class="layui-icon layui-icon-delete"></i>清空</button>
                            <a id="doImport" class="layui-btn add_btn">
                                <i class="layui-icon layui-icon-search"></i>导入</a>
                        </div>

                    </div>
                </div>
            </form>


            <!--数据列表展示-->
            <div>
                <table class="layui-hide" id="dataListTable" lay-filter="active"></table>
            </div>


        </div>
    </div>


</body>

<script>
    var table;
    var tableObj;

    var vm = avalon.define({
        $id: "test",
        recordId:'',
        searchKey:'',
        recordStatistics:[],
        shearch: function () {
            table.reload('loadDataList', {
                page: {
                    curr: 1 //重新从第 1 页开始
                }
                , where: {
                    exportStatus: $('#exportStatus').val(),
                    fileType:$('#fileType').val(),
                    searchKey:vm.searchKey,
                    recordId:vm.recordId
                   
                }
            });
            return false
        },
        // 	查询导出统计信息
        getrecordStatistics:function(){
            ax.get({
                url: backendWebUrl + "/api/student/review/recordStatistics",
                async: false,  //加了这个属性，
                data:{dataId:vm.recordId},
                contentType: "application/x-www-form-urlencoded",
                success: function (data) {
                    if (data.code == 0) {
                        console.log(data)
                        vm.recordStatistics=data.data
                    } else {

                    }

                }
            });
        }
    });
    vm.$watch('onReady', function () {
        //获取省市区
        vm.recordId=getQueryString('id');
        vm.getrecordStatistics();
        console.log(getQueryString('id'))

    })








    layui.use(['table', 'form', 'laydate', 'layer', 'element','upload'], function () {
        table = layui.table;

        var $ = layui.$,
            form = layui.form,
            layDateFrom = layui.laydate,
            layDateTo = layui.laydate,
            importFile = layui.upload,
            layer = layui.layer;

        // 初始化日期控件
        layDateFrom.render({
            elem: '#fromTime',
            type: "datetime"
        });
        layDateTo.render({
            elem: '#toTime',
            type: "datetime"
        });
        tableObj = ax.VTable({
            id: 'loadDataList',
            elem: '#dataListTable',
            url: backendWebUrl + '/api/student/review/listExportDetail?recordId='+getQueryString('id'),
            title: '导出记录明细',
            cols: [[
                { field: 'id', width: 80, title: '序号', fixed: 'left', type:"numbers"},
                { field: 'studentName', title: '姓名', width: 200, fixed: 'left' },
                { field: 'idNo', width: 200, title: '证件号' },
                { field: 'drivingLicenseType', width: 120, title: '车型' },
                { field: 'fileTypeName', width: 120, title: '文件' },
                { field: 'exportTime', width: 120, title: '导出时间' },
                { field: 'importTime', width: 120, title: '导入时间' }
            ]]

        });
        // 初始化上传控件
        ax.upload({
            elem: '#doImport' //绑定元素
            ,url: backendWebUrl + '/api/student/review/backWriteExportResult'//上传接口
            ,accept:"file"    // images（图片）、file（所有文件）、video（视频）、audio（音频）
            ,exts:'xls|xlsx'   // 允许上传的文件后缀。一般结合 accept 参数类设定
            ,data:{recordId:vm.recordId}
            ,before: function(obj){
                layer.msg('数据导入中...', {
                    icon: 16,
                    shade: 0.01,
                    time: 0
                })
            }
            ,done: function(res){
                layer.close(layer.msg());//关闭上传提示窗口
                if(res.code == 0) {
                    //上传完毕回调
                    layer.msg("导入成功");
                    searchData();
                } else {
                    layer.msg("导入失败");
                }

            }
            ,error: function(){
                //请求异常回调
                layer.msg("上传失败");
            }
        });
       
    });
</script>

</html>